import Vue from "vue";
import VueRouter from "vue-router"

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)
let wid = document.body.clientWidth;
let rout = wid > 1024 ? 'home' : 'mobile'
console.log(wid);
let router = new VueRouter({
    //routes
    routes: [{
        name: '首页',
        path: '/',
        component: () =>
            import (`../views/${rout}/index`)
    }, {
        name: '关于我们',
        path: '/about_us',
        component: () =>
            import ('../views/about/index')
    }, {
        name: '客户案例',
        path: '/customer',
        component: () =>
            import ('../views/customer/index')
    }, {
        name: '加盟中心',
        path: '/join',
        component: () =>
            import ('../views/join/index')
    }, {
        name: '资源中心',
        path: '/source',
        component: () =>
            import ('../views/source/index')
    }]
});

export default router